#include <stdio.h>
int main()
{
	int L = 0, R = 0;
	scanf("%d %d", &L, &R);
	int cnt = 0;
	for ( int i = L; i <= R; i++ ) {
		int n = i;
		while( n > 0 ) {
			if ( n % 10 == 2 ) {
				cnt ++;
			}
			n /= 10;
		}
	}
	printf("%d", cnt);
	return 0;
}
